//
//  ViewController.m
//  homework_UInavigationController
//
//  Created by dllo on 16/6/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "GestureImageView.h"
#import "FirstViewController.h"
#import "MyScrollView.h"

@interface ViewController ()<GestureImageViewDelegate>

@property (nonatomic, retain) UIImageView *imageView;

@property (nonatomic, retain) GestureImageView *gesture;

@end

@implementation ViewController

-(void)dealloc
{
    [_imageView release];
    [_gesture release];
    [super dealloc];
}

-(BOOL)prefersStatusBarHidden
{
    return YES;
}

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.title = @"图片";
    
    [self createNavigationBar];
    
    [self createSubView];
    
}


/**创建导航栏*/
-(void)createNavigationBar
{
    self.navigationController.navigationBar.barTintColor = [UIColor orangeColor];
}

/***/
-(void)createSubView
{
    NSArray *imageArray = [NSArray arrayWithObjects:
                           [NSArray arrayWithObjects:@"football.png", @"moon.png",nil],
                           [NSArray arrayWithObjects:@"sun.png", @"basketball.png",nil] ,
                           [NSArray arrayWithObjects:@"baseball.png", @"star.png",nil],nil];
    
    
    
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 2; j++) {
            static int count = 10001;
            
            self.gesture = [[GestureImageView alloc]initWithImage:[UIImage imageNamed:imageArray[i][j]] withFrame:CGRectMake(60 + j * 190, 100 + 150 * i, 100, 100)];
            
            self.gesture.tag = count + 1;
            
            [self.view addSubview:self.gesture];
            
            self.gesture.delegate = self;
            
            count++;
        }
    }
}

-(void)next:(GestureImageView *)gesture
{
    FirstViewController *firstVC = [[FirstViewController alloc]init];
    
    firstVC.tag = gesture.tag - 10001;
    
    [self.navigationController pushViewController:firstVC animated:YES];
}


@end








